package com.xoa.service.workflow.FlowManageLog.impl;

import com.xoa.dao.users.UsersMapper;
import com.xoa.dao.workflow.FlowManageLogMapper;
import com.xoa.model.workflow.FlowManageLog;
import com.xoa.service.workflow.FlowManageLog.FlowManageLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class FlowManageLogServiceImpl implements FlowManageLogService {

    @Autowired
    private FlowManageLogMapper flowManageLogMapper;
    @Autowired
    private UsersMapper usersMapper;
    //分页查询所有日志
    @Override
    public List<FlowManageLog> selectAllLogByPageAndTJ(Map map) {
        List<FlowManageLog> flowManageLogs=flowManageLogMapper.selectAllLogByPageAndTJ(map);
        for(FlowManageLog flowManageLog:flowManageLogs){
            flowManageLog.setUserName(usersMapper.getUsernameByUserId(flowManageLog.getUserId()));
        }
        return flowManageLogs;
    }

    @Override
    public boolean deleteLog(Integer id) throws Exception {
        return flowManageLogMapper.deleteLog(id);
    }

    @Override
    public List<FlowManageLog> getAllLog() throws Exception {
        return flowManageLogMapper.getAllLog();
    }

    @Override
    public List<FlowManageLog> selectAllLogByPage(Map map) {
        return flowManageLogMapper.selectAllLogByPage(map);
    }

}
